import java.util.ArrayList;
import java.util.List;

public class Test {

}
class Solution {
    public int[] circularGameLosers(int n, int k) {
        int[] ret = new int[n];
        int i = 0, count = 0;
        while(true){
            if(ret[i] == 1) break;
            if(ret[i] < 1){
                ret[i]++;
                count++;
            }
            i = i + count*k;
            i = i%n;
        }
        List<Integer> list = new ArrayList<>();
        for(i=0; i<n; i++){
            if(ret[i] == 0){
                list.add(i+1);
            }
        }
        int[] ans = new int[list.size()];
        k = 0;
        for(int x : list){
            ans[k++] = x;
        }
        return ans;
    }
}
